
#import <misckit/MiscSwapView.h>
#import "WoodInspectorManager.h"

#import "AttributesInspector.h"
#import "StyleInspector.h"
#import "TreeInspector.h"

@implementation WoodInspectorManager

- addDefaultInspectors
{
	[super addDefaultInspectors];
	[[AttributesInspector new] setManager:self];
	[[StyleInspector new] setManager:self];
	[[TreeInspector new] setManager:self];
	return self;
}

- loadNibSection
{
	[super loadNibSection];
	[window setBecomeKeyOnlyIfNeeded:YES];					 
	return self;
}

- makeKeyAndOrderFront:sender
{	
	if( [window isVisible] ) 
		[window orderFront:sender];
	else
	{
		[self updateInspectors];
		[swapView swapContentView:matrix];
	}
	return self;
}

- viewDidSwap:sender
{
	if( ![window isVisible] ) 
		[window orderFront:self];

	return self;
}

- inspect:anObject
{
	selection = anObject;
	if( selection == nil ) 
			selectionCount = 0;
	else	selectionCount = 1;

	if( [window isVisible] )
	{
		[self updateInspectors];
		[swapView swapContentView:matrix];
	}
	return self;
}

- inspectList:aList
{
	// If there is not really a List of object to inspect then lets handle it
	// as a simple inspection.
	
	if( [aList count] < 2 )
		return [self inspect:[aList objectAt:0]];
	
	// ...ok its a true list.
	
	selection = aList;
	selectionCount = [aList count];
	if( [window isVisible] )
	{
		[self updateInspectors];
		[swapView swapContentView:matrix];
	}
	return self;
}

@end

